<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <ul class="l1">
        <li>1</li>
        <li>2</li>
        <li>3</li>
        <li>4</li>
        <li>5</li>
    </ul>
    <ul class="l2">
        <li>a</li>
        <li>b</li>
        <li>c</li>
    </ul>
    <script>
        //构造函数Person
        /*
        function Person() {}
        Person.prototype.name = "issac";
        Person.prototype.age = 29;
        Person.prototype.job = "web Engineer";
        Person.prototype.sayName = function () {
            console.log(this.name);
        };
        var person1 = new Person();
        person1.name = "王大锤"
        person1.sayName(); //"Nicholas" 
        var person2 = new Person();
        person2.name = "张尼玛"
        person2.sayName(); //"Nicholas" 
        */

        // console.log(person1.sayName == person2.sayName); //true F
        /*
        const li1s = document.querySelectorAll('.l1 li')
        const li2s = document.querySelectorAll('.l2 li')
        */
        /*
         function Person(name, age, job) {
             this.name = name
             this.age = age
             this.job = job
             Person.prototype.sayName = function () {
                 console.log(`Hello everybody i am ${this.name}`)
             }
             Person.prototype.sayAge = function () {
                 console.log(`I am ${this.age} years old`)
             }
         }

         let person1 = new Person('lilei', 28, 'Java Engineer')
         let person2 = new Person('lily', 25, 'web Engineer')
         */

        function Person(name, age, job) {
            this.name = name
            this.age = age
            this.job = job
        }
        Person.prototype = {
            // constructor:Person,
            sayName: function () {
                console.log(`Hello everybody i am ${this.name}`)
            },
            sayAge: function () {
                console.log(`I am ${this.age} years old`)
            }
        }
        let person1 = new Person('lilei', 28, 'Java Engineer')
        let person2 = new Person('lily', 25, 'web Engineer')


        let p1 = {
            prototype:{
                constructor:function(){},
            
            }
        }
        // p1.prototype.age = 20
        //p1.prototype.name = "张二"
        p1.prototype = {
            age:20,
            name:"张二",
            constructor:p1
        }
       
    </script>
</body>

</html>